package com.neusoft.mapper;

import com.neusoft.po.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OrderDeliveryMapper {

    public List<Orders> listOrders();
    
    public List<Orders> listAcceptOrders(String deliveryWorkerId);

    @Update("update orders set deliveryState = 1, deliveryWorkerId = #{deliveryWorkerId} where orderId = #{orderId} AND deliveryState = 0")
    public Integer  acceptOrder(@Param("orderId") int orderId, @Param("deliveryWorkerId") String deliveryWorkerId);

    @Update({"update orders set deliveryState = 2 where orderId=#{orderId} AND deliveryWorkerId = #{deliveryWorkerId}"})
    public Integer  deliverOrder(@Param("orderId") int orderId, @Param("deliveryWorkerId") String deliveryWorkerId);
}
